<?php
namespace Profile\Controller;
use Profile\Controller\BaseController;
class GroupsController extends BaseController {
	private $tbl;
	public function _initialize(){
		$this->tbl='groups';
		$this->model=D($this->tbl);
		parent::_initialize();
	}
    public function index(){
		//$stunum=I('get.stunum');//获取id
		$stunum=$_SESSION['user']['yjl_stunum'];
		//创建的社团
		$data1=M("groups")->where("yjl_leader='{$stunum}' and yjl_check=1")->select();
		//var_dump($data1);exit;
		$this->assign("secblock1",$data1);
		//未通过
		$data1=M("groups")->where("yjl_leader='{$stunum}' and yjl_check=0")->select();
		$this->assign("secblock2",$data1);
		
		//驳回
		$data1=M("groups")->where("yjl_leader='{$stunum}' and yjl_check=2")->select();
		$this->assign("secblock3",$data1);
		$this->display();
    }
	public function ulist(){
		
	}
	public function	view(){
		$id=I('get.id');//获取id
	}
	public function	show(){//详细信息
		$id=I('get.id');//获取id--详细信息
		
		//$_SESSION['ngid']=$id;
		$_SESSION['user']['ngid']=$id;
		$data=$this->model->where("yjl_id='{$id}'")->find();
		$this->assign("firblock",$data);
		
		//社团成员--members
			$sql="select * from yjl_users where yjl_stunum in (
			select yjl_stunum from yjl_members where yjl_gid='{$id}' and yjl_check=1 )";
			$data1=M()->query($sql);
			$this->assign("secblock",$data1);
		
		//社团举办过的活动--practices
			$data2=M("practices")->where("yjl_gid='{$id}' and yjl_check=1 ")->select();
			$this->assign("thirblock",$data2);
		
		//var_dump($_SESSION['ngid']);exit;
		$this->display();
	}
	public function form(){//添加界面
		parent::form($this->tbl,"yjl_logo");
	}
	public function add(){//添加
		parent::add($this->tbl,"yjl_logo");
	}
	public function mod(){//修改界面
		 parent::mod($this->tbl,"yjl_id");
	}
	public function update(){//修改
		parent::update($this->tbl,"yjl_logo");
	}
	public function delete(){//删除
		parent::delete($this->tbl,"yjl_id","yjl_logo");
	}
}